package com.yuesystem.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yuesystem.common.R;
import com.yuesystem.entity.Academy;
import com.yuesystem.service.AcademyItemService;
import com.yuesystem.service.AcademyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 书院实体类
 */
@RestController
@RequestMapping("/academys")
@Slf4j
public class AcademyController {
    @Autowired
    private AcademyService academyService;

    /**
     * 获取所有省份信息,返回省份字符串列表
     * @return
     */
    @GetMapping("/provinceList")
    public R<List<String>> getProvince(){
        List<Academy> provinces = academyService.getProvince();
        List<String> provinceList = provinces.stream().map((item)->{
            return item.getAddress();
        }).collect(Collectors.toList());
        return R.success(provinceList);
    }


}
